﻿using FSM.Bll;
using FSM.IBll;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;

using Topshelf;

using Util.QuartzNet;

namespace FSM.AutoClean
{
    class Program
    {
        async static Task Main(string[] args)
        {
            await Task.FromResult(0);
            HostFactory.Run(x => {
                x.Service<MainService>(s =>
                {
                    s.ConstructUsing(name => new MainService());
                    s.WhenStarted(async tc => await tc.Start());
                    s.WhenContinued(async tc => await tc.Continue());
                    s.WhenPaused(async tc => await tc.Pause());
                    s.WhenStopped(async tc => await tc.Stop());
                });
                x.RunAsLocalSystem();

                x.SetDescription("定时删除文件管理系统被删除的文件");
                x.SetDisplayName("FSM.AutoClean");
                x.SetServiceName("FSM.AutoClean");
            });
        }
    }
}
